package com.bblei.designpatterndemo.observerpattern.mode;


public class InternetWeather {

  public static void main(String[] args) {

    CurrentConditions mCurrentConditions;
    ForcastConditions mForcastConditions;
    WeatherDataSt mWeatherDataSt;

    mWeatherDataSt = new WeatherDataSt();
    mCurrentConditions = new CurrentConditions();
    mForcastConditions = new ForcastConditions();

    mWeatherDataSt.registerObserver(mCurrentConditions);
    mWeatherDataSt.registerObserver(mForcastConditions);

    //subject 产生数据  利用保存在ArrayList中 的observe对象 再调用对应对象的update方法 那么observer 就能知道数据的变化
    mWeatherDataSt.setData(30, 150, 40);
    mWeatherDataSt.removeObserver(mCurrentConditions);
    mWeatherDataSt.setData(40, 250, 50);
  }

}
